package com.kuang.Mapper;

import com.kuang.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

public class UserMapperImpl implements UserMapper{

    /**
     *之前所有的操作都用SqlSession执行，现在都是用SqlSessionTemplate执行
     */
    private SqlSessionTemplate template;

    public void setTemplate(SqlSessionTemplate template) {
        this.template = template;
    }

    @Override
    public List<User> selectUser() {
        UserMapper mapper = template.getMapper(UserMapper.class);
        return mapper.selectUser();
    }

    @Override
    public int addUser(User user) {
        return 0;
    }

    @Override
    public int deleteUser(int id) {
        return 0;
    }
}
